Attribute Name "Contains"

I'm building a DXL layout column that would display test results for each requirement object for different SW "Builds". Each time a test is run, the test result values (Pass, Fail, N/A, etc) are stored in a new attribute named "BuildX.X.X" (where "X" is the actual Build number).

I'm hoping I can create the DXL layout column to display the results if that result is NOT "N/A". then display result and the attribute "Created On" date. This will provide me with a view that shows all the requirements that were tested (where the results were applicable for that requirement, and the date those results were posted. The (simple?) problem I'm having is that I see a lot of examples for filtering if the value of an attribute "contains", but not so much if the Name of the attribute "contains" (in this case, the Name contains "Build").

Does anyone have any suggestions? Maybe I should create a DXL Attribute based on one of the existing "Build" attributes and then modify it? I'm just trying to get my head around this...

Thanks!


Chris Annal - Wed Jan 21 10:40:07 EST 2015

Re: Attribute Name "Contains"
Chris Annal - Wed Jan 21 11:13:04 EST 2015

I did manage to create an If statement that will look for "Build" in the attribute Name:

string sObjAttrName
for sObjAttrName in (current Module) do
{
string sBuild = sObjAttrName
string sub = "Build"
if (sBuild [0:4] == sub)
 {
 print sBuild "\n"
 }
}

Re: Attribute Name "Contains"
GregM_dxler - Wed Jan 21 12:18:11 EST 2015

Chris Annal - Wed Jan 21 11:13:04 EST 2015

I did manage to create an If statement that will look for "Build" in the attribute Name:

string sObjAttrName
for sObjAttrName in (current Module) do
{
string sBuild = sObjAttrName
string sub = "Build"
if (sBuild [0:4] == sub)
 {
 print sBuild "\n"
 }
}

Hi Chris

The following should work if the attribute is a multivalue enumeration.

If it is a single value enumeration you can just use obj.sObjAttrName == "N/A" for the condition.

string sObjAttrName

if(exists attribute sObjAttrName) {

   if(canRead obj.sObjAttrName) {

      if(!isMember(obj.sObjAttrName, "N/A")){

         display obj.sObjAttrName

          display obj."Created On"

     }    

   }

}

Hope this helps,

Greg

Re: Attribute Name "Contains"
Wolfgang Uhr - Thu Jan 22 10:17:58 EST 2015

Regexp containsBuild = regexp2("Build");

string sTest = "ThisNameContainsBuildSomewhere";

boolbContainsBuild = containsBuild(sTest);

printbContainsBuild;

sTest = "ThisNameContains...Somewhere";

bContainsBuild = containsBuild(sTest);

printbContainsBuild;

Re: Attribute Name "Contains"
ChrisAnnal - Thu Jan 29 08:48:24 EST 2015

Thanks Greg and Wolfgang!! I like your suggestions and will keep them in my DXL folder. They look useful for a number of things! 

Now I have a dumb question. Does anyone know how to mark a topic that they started (such as this one)  as "Answered"? I notice under my topic heading a little notification that says, "This question has not been answered yet" - but offers no link to update that status.

Re: Attribute Name "Contains"
GregM_dxler - Thu Jan 29 15:54:40 EST 2015

ChrisAnnal - Thu Jan 29 08:48:24 EST 2015

Thanks Greg and Wolfgang!! I like your suggestions and will keep them in my DXL folder. They look useful for a number of things! 

Now I have a dumb question. Does anyone know how to mark a topic that they started (such as this one)  as "Answered"? I notice under my topic heading a little notification that says, "This question has not been answered yet" - but offers no link to update that status.

Hi Chris,

Good question.  I guess I haven't asked a question in a long time.  The help talks about a notification, or clicking the Accept this Answer.  I don't see that, so I don't know if it is because I didn't post the question, have the wrong browser, or what.

Here is the help on the subject.

You can post an answer to your own question by clicking Add Your Answer and following the steps described in Answering questions in a forum. When you post an answer to a question that you created yourself, the answer is automatically marked as an accepted answer.

To accept an answer posted by another user, click Accept this Answer under the answer. The response is marked as an accepted answer and the icon next to the original question changes to a green tick Answered question icon. Accepted answers are also highlighted with a green background, making it easy for you to identify them when the question has a lot of responses. You can mark multiple replies as accepted answers. When one reply is marked as an answer, the entire topic is marked as answered.

To reject an answer that has already been marked as accepted, click Decline this Answerunder the response.

If your question is marked as answered, but you later find that you need more information, you can click Reopen Question under the original post to reopen the question. The question is marked as open again and users can post answers to it.

 

Hope this helps,

Greg